package com.ludomancy.archeologyrpg.entities;

import java.awt.Graphics;
import java.awt.Point;

import com.ludomancy.archeologyrpg.Entity;
import com.ludomancy.archeologyrpg.Game;
import com.ludomancy.archeologyrpg.GameTheme;

public class BuildSite extends Entity
{
	private static final int BUILD_TIME = Game.discretize(2500);
	private int buildTime = 0;
	private int buildSpeed = Game.discretize(20);
	
	public BuildSite(Point p)
	{
		super(p);
	}
	
	public void paint(Graphics g, int x, int y)
	{
		paintDefaultIcon(g, BUILD_SITE, x, y);
	}
		
	public void update(boolean running, boolean activated)
	{
		if(activated)
		{
			buildTime += buildSpeed;
			if(buildTime > BUILD_TIME)
			{
				buildTime = BUILD_TIME;
				dead = true;
				// spawn beacon
				Game.game.entities.add(new Beacon(px/Game.TILE_SIZE,py/Game.TILE_SIZE));
			}
		}
	}

	public void paintInfo(Graphics g)
	{
		g.setColor(GameTheme.theme.getDefaultTextColor());
		g.setFont(GameTheme.theme.tinyFont);
		GameTheme.theme.paintBar(g, px, py+Game.ENTITY_TILE_SIZE, buildTime, BUILD_TIME);
	}
	
	public String getActionVerb()
	{
		return "Build";
	}
}
